# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# File: $Id: dialogs.py 24 2007-12-18 11:48:29Z mingli.yuan $
# Revision: $Revision: 24 $
#----------------------------------------------------------------------------
# py-jasmine: A python GUI tool for pdf journal making
# Copyright (C) 2007  Mingli Yuan
#
# This program is a part of py-jasmine.
#
# py-jasmine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# py-jasmine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with py-jasmine. If not, see <http://www.gnu.org/licenses/>.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://py-jasmine.googlecode.com/svn/trunk/.
#
#----------------------------------------------------------------------------

"""dialogs for various usages
@version: $Id: dialogs.py 24 2007-12-18 11:48:29Z mingli.yuan $
@author: Mingli Yuan <me@mingli-yuan.info>
@license: gpl
"""

__version__ = "$Revision: 24 $"


import wx

import meide as ui

class NewIssueDialog(ui.SimpleDialog):
    def __init__(self, parent, title, default_value='', fit=1, size=wx.DefaultSize):
        box = ui.SimpleGrid(namebinding='element')
        self.template_file = box.add("Input template file path", ui.OpenFile(default_value), name='template_file', span=True)
        self.base_path = box.add("Input base path for the new issue", ui.Dir(default_value), name='base_path', span=True)
        super(NewIssueDialog, self).__init__(parent, box, title, fit=fit, size=size)

    def GetTemplate(self):
        return self.template_file.GetValue()

    def GetBasePath(self):
        return self.base_path.GetValue()


class OpenIssueDialog(ui.SimpleDialog):
    def __init__(self, parent, title, default_value='', fit=1, size=wx.DefaultSize):
        box = ui.SimpleGrid(namebinding='element')
        self.base_path = box.add("Input base path for the new issue", ui.Dir(default_value), name='base_path', span=True)
        super(OpenIssueDialog, self).__init__(parent, box, title, fit=fit, size=size)

    def GetBasePath(self):
        return self.base_path.GetValue()


class NewTemplateDialog(ui.SimpleDialog):
    def __init__(self, parent, title, default_value='', fit=1, size=wx.DefaultSize):
        box = ui.SimpleGrid(namebinding='element')
        self.base_path = box.add("Input base path for the new template", ui.Dir(default_value), name='base_path', span=True)
        super(NewTemplateDialog, self).__init__(parent, box, title, fit=fit, size=size)

    def GetBasePath(self):
        return self.base_path.GetValue()


class OpenTemplateDialog(ui.SimpleDialog):
    def __init__(self, parent, title, default_value='', fit=1, size=wx.DefaultSize):
        box = ui.SimpleGrid(namebinding='element')
        self.template_file = box.add("Input template file path", ui.OpenFile(default_value), name='template_file', span=True)
        super(OpenTemplateDialog, self).__init__(parent, box, title, fit=fit, size=size)

    def GetTemplate(self):
        return self.template_file.GetValue()

